package com.yinuo.entity;

import javax.persistence.*;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;

/**
 * Created by gt.ao on 2018/8/31.
 */
@Table(name="DOC_BINARY")
@Entity
public class DocBinary {
    @Id
    private String doc_id;
    private String doc_type;
    private String author;
    private String intime;
    @Column(name="UPDATETIME")
    private String updateTime;
    private String title;
    private byte[] content;
    private String remark;


    @Lob
    @Basic(fetch = FetchType.LAZY)
    @Column(name = "CONTENT", columnDefinition = "BLOB",nullable=true)
    public byte[] getContent() {
        return content;
    }

    public void setContent(String htmlContent) {
        try {
            this.content = htmlContent.getBytes("utf-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
    }

    public String getDoc_id() {
        return doc_id;
    }

    public void setDoc_id(String doc_id) {
        this.doc_id = doc_id;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getIntime() {
        return intime;
    }

    public void setIntime(String intime) {
        this.intime = intime;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }

    public String getDoc_type() {
        return doc_type;
    }

    public void setDoc_type(String doc_type) {
        this.doc_type = doc_type;
    }

    @Override
    public String toString() {
        return "DocBinary{" +
                "DOC_ID='" + doc_id + '\'' +
                "DOC_TYPE='" + doc_type + '\'' +
                ", AUTHOR='" + author + '\'' +
                ", INTIME='" + intime + '\'' +
                ", UPDATETIME='" + updateTime + '\'' +
                ", CONTENT=" + Arrays.toString(content) +
                ", REMARK='" + remark + '\'' +
                '}';
    }
}
